home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_libgtop.idb / usr / freeware / include / glibtop / procstate.h.z / procstate.h
Encoding:
C/C++ Source or Header  |  1999-07-16  |  2.8 KB  |  91 lines

  1. /* $Id: procstate.h,v 1.13 1999/02/23 11:43:11 martin Exp $ */
  2.  
  3. /* Copyright (C) 1998-99 Martin Baulig
  4.    This file is part of LibGTop 1.0.
  5.  
  6.    Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
  7.  
  8.    LibGTop is free software; you can redistribute it and/or modify it
  9.    under the terms of the GNU General Public License as published by
  10.    the Free Software Foundation; either version 2 of the License,
  11.    or (at your option) any later version.
  12.  
  13.    LibGTop is distributed in the hope that it will be useful, but WITHOUT
  14.    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15.    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  16.    for more details.
  17.  
  18.    You should have received a copy of the GNU General Public License
  19.    along with LibGTop; see the file COPYING. If not, write to the
  20.    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21.    Boston, MA 02111-1307, USA.
  22. */
  23.  
  24. #ifndef __GLIBTOP_PROCSTATE_H__
  25. #define __GLIBTOP_PROCSTATE_H__
  26.  
  27. #include <glibtop.h>
  28. #include <glibtop/global.h>
  29.  
  30. BEGIN_LIBGTOP_DECLS
  31.  
  32. #define GLIBTOP_PROC_STATE_CMD        0
  33. #define GLIBTOP_PROC_STATE_STATE    1
  34. #define GLIBTOP_PROC_STATE_UID        2
  35. #define GLIBTOP_PROC_STATE_GID        3
  36.  
  37. #define GLIBTOP_MAX_PROC_STATE        4
  38.  
  39. typedef struct _glibtop_proc_state    glibtop_proc_state;
  40.  
  41. /* Name and status */
  42.  
  43. struct _glibtop_proc_state
  44. {
  45.     u_int64_t flags;
  46.     char cmd[40],        /* basename of executable file in 
  47.                  * call to exec(2) */
  48.         state;        /* single-char code for process state
  49.                  * (S=sleeping) */
  50.     /* NOTE: when porting the library, TRY HARD to implement the
  51.      *       following two fields. */
  52.     /* IMPORTANT NOTICE: For security reasons, it is extremely important
  53.      *                   only to set the flags value for those two
  54.      *                   fields if their values are corrent ! */
  55.     int uid,        /* UID of process */
  56.         gid;        /* GID of process */
  57. };
  58.  
  59. #define glibtop_get_proc_state(p1, p2)    glibtop_get_proc_state_l(glibtop_global_server, p1, p2)
  60.  
  61. #if GLIBTOP_SUID_PROC_STATE
  62. #define glibtop_get_proc_state_r    glibtop_get_proc_state_p
  63. #else
  64. #define glibtop_get_proc_state_r    glibtop_get_proc_state_s
  65. #endif
  66.  
  67. void glibtop_get_proc_state_l (glibtop *server, glibtop_proc_state *buf, pid_t pid);
  68.  
  69. #if GLIBTOP_SUID_PROC_STATE
  70. void glibtop_init_proc_state_p (glibtop *server);
  71. void glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, pid_t pid);
  72. #else
  73. void glibtop_init_proc_state_s (glibtop *server);
  74. void glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid);
  75. #endif
  76.      
  77. #ifdef GLIBTOP_NAMES
  78.  
  79. /* You need to link with -lgtop_names to get this stuff here. */
  80.  
  81. extern const char *glibtop_names_proc_state [];
  82. extern const unsigned glibtop_types_proc_state [];
  83. extern const char *glibtop_labels_proc_state [];
  84. extern const char *glibtop_descriptions_proc_state [];
  85.  
  86. #endif
  87.  
  88. END_LIBGTOP_DECLS
  89.  
  90. #endif
  91.